require.config({
                baseUrl:"../",
	paths:{
		bsl:'bsl',

	}
});
require(['bsl'],function(bsl){
//define(["require"], function(require) {
//       var bsl = require("bsl");
	document.addEventListener('deviceready', onDeviceready, false);
        function onDeviceready(){
        alert("star");
        
        //barcode
        function scan(){
        bsl.barcode.scan(
                         function (result) {
                         alert("获取到一只野生的二维码\n" +
                               "扫描结果: " + result.text + "\n" +
                               "编码类型: " + result.format + "\n" +
                               "能否回调: " + result.cancelled);
                         },
                         function (error) {
                         alert("Scanning failed: " + error);
                         });
        
        
        }
        //加码
        function encodeF() {
        bsl.barcode.encode(cordova.plugins.barcodeScanner.Encode.TEXT_TYPE, "http://www.baidu.com", function(success) {
                           alert("encode success: " + success);
                           }, function(fail) {
                           alert("encoding failed: " + fail);
                           }
                           );
        
        }
//        document.getElementById("encode").onclick=function(){encodeF()};
        document.getElementById("scan").onclick=function(){scan()};
        }
});